<template>
	<div class="swiper-container swiper-container-horizontal swiper-no-swiping">
		<div class="swiper-wrapper">
			<div class="swiper-slide swiper-slide-prev" style="width: 1854px;" v-for="(item, index) in contentList" :key="index">
				<a class="block_a" :href="Path + item?.url"><img :src="getImgPath((item.extend?.singleImgUploadUmFb?item.extend.singleImgUploadUmFb :'') ||  item.headImag || '')" alt="" class="img1" /></a>
			</div>
		</div>
		<!-- Add Pagination -->
		<!-- <div class="swiper-pagination"></div> -->
		<!-- Add Navigation -->
		<div class="swiperButton"><span class="iconfont icon-a-Leftarrow"></span></div>
		<div class="swiperButton swiperButton_right"><span class="iconfont icon-a-Rightarrow"></span></div>
	</div>
</template>

<script>
export default {
	data() {
		return {
			contentList: [],
			Path: getRootPath(),
			query: GetQueryString(),
		};
	},
	mounted() {
		this.getContentOfChannel();
	},
	methods: {
		inintSlide() {
			var swiper = new Swiper('.swiper-container', {
				// pagination: '.swiper-pagination',
				pagination: {
				        el: ".swiper-pagination",
				        clickable: true,
				      },
				paginationClickable: true,
				navigation: {
				    nextEl: ".icon-a-Rightarrow",
				    prevEl: ".icon-a-Leftarrow",
				},
				parallax: true,
				speed: 1000,
				loop: true,
				autoplay: {
				        delay: 5000,
				      },
			});
			$('.swiper-container').mouseover(function() {
				swiper.autoplay.stop();
				// 停止自动滚动
			});
			$('.swiper-container').mouseout(function() {
				swiper.autoplay.start();
			});
		},
		getContentOfChannel() {
			let param = {
				pageNum: 1,
				pageSize: 6,
				channelIdStr: this.query.id,
				typeIdStr: '1002',
				orderBy: 3,
			};
			contentApi.fetchContentOfChannel(param, res => {
				if (res.code == '00000 00000') {
					this.contentList = res.data.records;
					this.activeContent = res.data.records[0];
					this.$nextTick(() => {
						this.inintSlide();
					});
				} else {
				}
			});
		},
		getImgPath(url){
			return imgPath(url);
		},
	}
};
</script>

<style scoped="scoped">
.swiper-container {
	width: 100%;
	position: relative;
	height: fit-content;
}
.swiper-container:hover .swiperButton {
	display: flex;
}


.swiper-pagination-bullet {
	background-color: #fff;
	opacity: 0.5;
}
.swiper-pagination-bullet-active {
	opacity: 1;
}
.img1 {
	width: 100%;
	height: auto;
	border-radius: 4px 0px 0px 4px;
}
.swiper-container .swiper-slide{
	height:fit-content;
}
.swiperButton {
	width: 56px;
	height: 56px;
	background: #333333;
	opacity: 0.3;
	position: absolute;
	display: flex;
	justify-content: center;
	align-items: center;
	border-radius: 100%;
	top: calc(50% - 28px);
	left: 24px;
	z-index: 2;
	display: none;
}
.swiperButton:hover{
	opacity: 0.5;
}
.swiperButton .iconfont {
	color: #fff;
	font-size: 48px;
	font-weight: 400;
	opacity: 1;
}
.swiper-container .swiperButton_right {
	right: 24px;
	left: auto;
}
</style>
<style>
.swiper-container {
	width: 100%;
	position: relative;
	height: 518px;
}
.swiper-container .swiper-pagination-bullet {
	background-color: #fff;
	width: 10px;
	height: 10px;
	opacity: 0.5;
}
.swiper-container .swiper-pagination-bullet-active {
	opacity: 1;
}
.swiper-container-horizontal>.swiper-pagination-bullets, .swiper-pagination-custom, .swiper-pagination-fraction{
	bottom: 24px;
}
</style>
